package com.itcast.mapper;

import com.itcast.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
@Select("select * from user")
@Results(id ="userMap", value = {
        @Result(id =true, column = "id" ,property = "id"),
        @Result(column = "username",property = "username"),
        @Result(column = "birthday",property = "birthday"),
        @Result(column = "sex",property = "sex"),
        @Result(column = "address",property = "address")

})

    List<User> findAll();


@ResultMap("userMap")
@Update("update user set username=#{username} where id=#{id}")
    void update();

@Select("select * from user where email=#b {email} and password=#{password}" )
    User findByEmailAndPassword(@Param("email")String email,@Param("password") String password);

}
